
#include "glog/logging.h"
#include "mutex"

#include "iostream"
#include <type_traits>


//template<typename T, typename... Types>
//struct is_any_of : std::disjunction<std::is_same<T, Types>...> {
//};
// cmake -S . -B cmake-build-debug/ -G "Ninja"

void test_glog() {
    //    FLAGS_minloglevel = google::GLOG_INFO;
    //    FLAGS_logtostderr = true;
    //https://blog.csdn.net/xihuanyuye/article/details/122450999
    //    FLAGS_log_backtrace_at = "main.cpp:17";

    // see: https://static.kancloud.cn/bjm123456/c____/2568927
    LOG(INFO) << "Hello world.";
    LOG(ERROR) << "This is a error message.";
    DLOG(ERROR) << "Hello.";
    //    GLOG_log_backtrace_at=main.cpp:22 ./cmake_hello
    PLOG(INFO) << "This is plog.";
}

template<std::size_t... Indices, typename Func>
void for_each_index(std::index_sequence<Indices...>, Func &&func) {
    (func(std::integral_constant<std::size_t, Indices>{}), ...);
}


int main(int argc, char *argv[]) {
    google::ParseCommandLineFlags(&argc, &argv, true);
    google::InitGoogleLogging(argv[0]);
    google::InstallFailureSignalHandler();

    atexit([]() {
        LOG(INFO) << "Bye world.";
        google::ShutdownGoogleLogging();
    });

//    LOG(INFO) << "is any of character: " << std::boolalpha << is_any_of<int, float, double>();

//    std::index_sequence<0, 1, 2, 3> indices;
//    std::make_index_sequence<10> indices;
    std::make_integer_sequence<int, 5> indices;
    LOG(INFO) << "indices size: " << indices.size();
//    for_each_index(indices, [](auto index) {
//        LOG(INFO) << index << " ";
//    });


    return 0;
}

#include <iostream>
#include <utility>
